package com.ktjiaoyu.crm.exception;

import org.apache.shiro.authz.UnauthorizedException;
import org.springframework.web.bind.annotation.ControllerAdvice;
import org.springframework.web.servlet.ModelAndView;

import javax.servlet.http.HttpServletRequest;

@ControllerAdvice
public class GlobalExceptionHandler {
    public ModelAndView unauthorizedExceptionHandler(HttpServletRequest request, UnauthorizedException e){//出现异常后会跳到此方法
        ModelAndView mv=new ModelAndView("403");//设置跳转路径
        mv.addObject("exception",e);
        mv.addObject("url",request.getRequestURL());//获得请求的路径
        return mv;
    }
}
